from sklearn.datasets import load_iris
import pandas as pd
import requests


def data_demo():
    # 获取数据集
    iris = load_iris()
    # print("鸢尾花数据集：\n", iris)
    # 查看数据集描述
    print("数据集描述：\n", iris.DESCR)
    # print(iris.data)
    # print(iris.target)
    # print(iris.feature_names)
    # print(iris.target_names)
    # print(iris.DESCR)
    # print(iris.filename)
    # print(iris.data_module)
    # print(iris.keys())
    # print(iris.data.shape)
    # print(iris.target.shape)
    # print(iris.data[0])


def data_demo2():
    # 获取过去30天全球5.0级以上地震数据
    url = "https://earthquake.usgs.gov/fdsnws/event/1/query?format=csv&minmagnitude=5&starttime=2024-01-01"
    df = pd.read_csv(url)
    df.to_csv("./data/recent_earthquakes.csv", index=False)  # 保存到本地


if __name__ == '__main__':
    # data_demo()
    data_demo2()
